dofile ("libButton.lua")

Button.init (SCREEN_DOWN, 5, 5, 100, 25, "Bouton 1", 1)
Button.init (SCREEN_DOWN, 5, 50, 100, 25, "Bouton 2", 2)

txt = ""

while not Keys.newPress.Start do
   
   Controls.read()
   
   startDrawing()
     
     Button.draw (1)
     Button.draw (2)
     
     screen.print (SCREEN_UP, 5, 5, txt)
     
     if Button.clicked (1) then
       txt = "Button 1 clicked"
     elseif Button.clicked (2) then
       txt = "Button 2 clicked"
     end
     
   stopDrawing()

end

txt = nil

Button.clear (1)
Button.clear (2)

